Inside Macintosh: Macintosh Toolbox Essentials

Previous | Chapter Top | Chapter Contents | Next

Low-Level Functions

This section describes the low-level functions that are called by higher-level Window Manager functions. Ordinarily, you won't need to use these functions.

CheckUpdate

Scans the window list for windows that need updating.

pascal Boolean CheckUpdate (EventRecord *theEvent);
theEvent
A pointer to an event record to be filled in if a window needs updating.

DESCRIPTION

The CheckUpdate function scans the window list from front to back, checking for a visible window that needs updating (that is, a visible window whose update region is not empty). If it finds one whose window record contains a picture handle, it redraws the window itself and continues through the list. If it finds a window record whose update region is not empty and whose window record does not contain a picture handle, it stores an update event in the event record referenced through the parameter theEvent and returns true . If it finds no such window, it returns false .

The Event Manager is the only software that ordinarily calls CheckUpdate .

ClipAbove

Determines the clip region of the Window Manager port.

pascal void ClipAbove (WindowPtr window);
window
A pointer to the window's complete window record.

DESCRIPTION

The ClipAbove function sets the clip region of the Window Manager port to be the area of the desktop that intersects the current clip region, minus the structure regions of all the windows in front of the specified window.

The ClipAbove function retrieves the desktop region from the global variable GrayRgn.

The Window Manager is the only software that ordinarily calls ClipAbove .

SaveOld

Saves a window's current structure and content regions.

pascal void SaveOld (WindowPtr window);
window
A pointer to the window's complete window record.

DESCRIPTION

The SaveOld function saves the specified window's current structure region and content region for the DrawNew function (DrawNew) . Each call to SaveOld must be balanced by a subsequent call to DrawNew.

The Window Manager calls DrawNew before updating a window.

DrawNew

Erases and updates changed window regions.

pascal void DrawNew (WindowPtr window,
                                         Boolean update);
window
A pointer to the window's complete window record.
update
A Boolean value that determines whether the regions are updated.

DESCRIPTION

The DrawNew function erases the parts of a window's structure and content regions that are part of the window's former state and part of its new state but not both.

If the update parameter is set to true , DrawNew also updates the erased regions.

Each call to SaveOld must be balanced by a subsequent call to DrawNew . In C, SaveOld and DrawNew can't be nested. That is, you must call DrawNew before the next call to SaveOld .

The Window Manager is the only software that ordinarily calls DrawNew .

ASSEMBLY-LANGUAGE INFORMATION

In assembly language, you can nest SaveOld and DrawNew if you save and restore the values of the global variables OldStructure and OldContent .

PaintOne

Redraws the invalid, exposed portions of one window on the desktop.

pascal void PaintOne (WindowPtr window, RgnHandle clobberedRgn);
window
A pointer to the window's complete window record.
clobberedRgn
A handle to the region that has become invalid.

DESCRIPTION

The PaintOne function "paints" the invalid portion of the specified window and all windows above it. It draws as much of the window frame as is in clobberedRgn and, if some content region is exposed, erases the exposed area (paints it with the background pattern) and adds it to the window's update region. If the value of the window parameter is nil , the window is the desktop, and PaintOne paints it with the desktop pattern.

The Window Manager is the only software that ordinarily calls PaintOne .

ASSEMBLY-LANGUAGE INFORMATION

The global variables SaveUpdate and PaintWhite are flags used by PaintOne . Normally both flags are set. Clearing SaveUpdate prevents clobberedRgn from being added to the window's update region. Clearing PaintWhite prevents clobberedRgn from being erased before being added to the update region (this is useful, for example, if the background pattern of the window isn't the background pattern of the desktop). The Window Manager sets both flags periodically, so you should clear the appropriate flags each time you need them to be clear.

PaintBehind

Redraws a series of windows in the window list.

pascal void PaintBehind (WindowPtr startWindow,
                     RgnHandle clobberedRgn);
startWindow
A pointer to the window's complete window record.
clobberedRgn
A handle to the region that has become invalid.

DESCRIPTION

The PaintBehind function calls PaintOne (PaintOne) for startWindow and all the windows behind startWindow , clipped to clobberedRgn .

The Window Manager is the only software that ordinarily calls PaintBehind .

ASSEMBLY-LANGUAGE INFORMATION

Because PaintBehind clears the global variable PaintWhite before calling PaintOne , clobberedRgn isn't erased. The PaintWhite global variable is reset after the call to PaintOne .

CalcVis

Calculates the visible region of a window.

pascal void CalcVis (WindowPtr window);
window
A pointer to the window's complete window record.

DESCRIPTION

The CalcVis function calculates the visible region of the specified window by starting with its content region and subtracting the structure region of each window in front of it.

The Window Manager is the only software that ordinarily calls CalcVis .

CalcVisBehind

Calculates the visible regions of a series of windows.

pascal void CalcVisBehind (WindowPtr startWindow,
                     RgnHandle clobberedRgn);
startWindow
A pointer to a window's window record.
clobberedRgn
A handle to the desktop region that has become invalid.

DESCRIPTION

The CalcVisBehind function calculates the visible regions of the window specified by the startWindow parameter and all windows behind startWindow that intersect clobberedRgn . It is called after PaintBehind .

The Window Manager is the only software that ordinarily calls CalcVisBehind .


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next